package test.y2020;

import java.util.concurrent.*;

/**
 * @author songx
 * @date 2020/5/10 23:30
 */
public class May2 {

    private static final Executor EXECUTORS = new ThreadPoolExecutor(4, 16, 100, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(1024), (ThreadFactory) Thread::new);


    Object lock;

    public May2(Object lock) {
        this.lock = lock;
    }

    private void demo() {
        synchronized (lock) {
        }
    }

    public static void main(String[] args) {
        Object lock = new Object();
        May2 th1 = new May2(lock);
        May2 th2 = new May2(lock);
        new Thread(() -> th1.demo()).start();
        new Thread(() -> th2.demo()).start();
    }

}
